#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Action.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class OutputPin;
class ValueSpecification;

/// <summary>
/// ValueSpecificationAction
/// A ValueSpecificationAction is an Action that evaluates a ValueSpecification and
/// provides a result.
/// </summary>
class UMLMODEL_EXPORT ValueSpecificationAction : public Action {

public: // Constructors and destructors
    explicit ValueSpecificationAction(const QString& umlType="uml::ValueSpecificationAction");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// result getter
    /// The OutputPin on which the result value is placed.
    /// </summary>
    shared_ptr<OutputPin> result() const;

    /// <summary>
    /// result setter
    /// The OutputPin on which the result value is placed.
    /// </summary>
    void setResult(shared_ptr<OutputPin> value);

    /// <summary>
    /// value getter
    /// The ValueSpecification to be evaluated.
    /// </summary>
    shared_ptr<ValueSpecification> value() const;

    /// <summary>
    /// value setter
    /// The ValueSpecification to be evaluated.
    /// </summary>
    void setValue(shared_ptr<ValueSpecification> value);

private: // Fields
    /// <summary>
    /// result
    /// The OutputPin on which the result value is placed.
    /// </summary>
    shared_ptr<OutputPin> result_;

    /// <summary>
    /// value
    /// The ValueSpecification to be evaluated.
    /// </summary>
    shared_ptr<ValueSpecification> value_;

};

} // namespace uml
